package sk.naive.talker.command;

import sk.naive.talker.persistence.PersistenceException;
import sk.naive.talker.props.*;

import java.rmi.RemoteException;
import java.util.Set;

/**
 * Nastavovanie pouzivatelskych properties.
 *
 * @author <a href="mailto:richter@bgs.sk">Richard Richter</a>
 * @version $Revision: 1.8 $ $Date: 2005/01/11 22:19:13 $
 */
public class SetCommand extends AbstractSetCommand {
	protected String setValue(String key, String value)
		throws RemoteException,
		PropertyStoreException,
		PersistenceException
	{
		user.set(key, user.getProperty(key).toObject(value));
		return value;
	}

	protected Set getValidValues(String key) throws RemoteException {
		return user.getProperty(key).validValues();
	}

	protected String getValue(String key) throws RemoteException, PropertyStoreException {
		return user.getProperty(key).toString(user.get(key));
	}

	protected Set<String> settable() {
		return user.getSettable();
	}
}
